package gold.digger;

/**
 * Created by fanzhenyu02 on 2020/3/1.
 */
public class LC674 {

    public int findLengthOfLCIS(int[] nums) {
        if (null == nums || nums.length <= 0) {
            return 0;
        }

        if (nums.length == 1) {
            return 1;
        }

        int maxLength = 1, start = 0, end = 0;
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] <= nums[i - 1]) {
                if (end - start + 1 > maxLength) {
                    maxLength = end - start + 1;
                }
                start = i;
                end = i;
            } else {
                end++;
            }
        }

        if (end - start + 1 > maxLength) {
            maxLength = end - start + 1;
        }
        return maxLength;
    }


    public static void main(String[] args) {
        LC674 an = new LC674();
//        int[] arr = {1, 3, 0, 1, 2, 3, 5, 4, 7};
        int[] arr = {1, 3, 5, 7};
        System.out.println(an.findLengthOfLCIS(arr));
    }
}
